function saveMatrix(fid, X)

fprintf(fid, '%d %d\n', size(X));
for i = 1:size(X, 1)
    fprintf(fid,  '%.30g', X(i, 1));
    fprintf(fid, ' %.30g', X(i, 2:end));
    fprintf(fid, '\n');
end